import React, { Fragment, useEffect } from 'react';
import { Card } from 'antd';
import { getDashboard } from '@/services/api';
import ClasesEchars from './components/ClasesEchars';
import GradeEchars from './components/GradeEchars';
import ApplyEchars from './components/ApplyEchars';

const Dashboard = () => {
  useEffect(() => {
    getDashboard().then((resp: any) => {
      if (resp.status === 'success') {
        sessionStorage.setItem('dashboardData', JSON.stringify(resp.data));
      }
    });
  }, []);
  return (
    <Fragment>
      <Card title="年级人数">
        <GradeEchars />
      </Card>
      <Card title="班级人数" className="pageCard">
        <ClasesEchars />
      </Card>
      <Card title="报名人数" className="pageCard">
        <ApplyEchars />
      </Card>
    </Fragment>
  );
};

export default Dashboard;
